#include "OptionPage.h"
#include "OptionItem.h"

#include "LinkTo.h"

#include "../Settings.h"

OptionPage::OptionPage(std::string section)
{
    current_item = 0;
    current_top_item = 0;
    num_items = 1;
    items.push_back(new LinkTo("options"));

    // get the sections option names
    std::vector<std::string> settings = Settings::instance().getSection(section);
    std::vector<std::string>::iterator it;
    for (   it = settings.begin();
            it != settings.end();
            ++it) {
        std::cerr << "creating option [" << section << "][" << *it << "] = " <<
            Settings::instance().getStringValue(section, *it) << std::endl;
        // create an option item
        items.push_back(new OptionItem(section, *it));
        num_items++;
    }

    title = section;
//    std::cerr << "init optionspage\n";
}

OptionPage::~OptionPage() {}
